import { Callout } from "nextra/components";
import VideoEmbed from "../../components/video-embed";

# Image Feature Extraction

> Extract and analyze visual features from satellite imagery using AI embeddings

<Callout type="default" emoji="🚀">
  **Powered by Meta's DINOv3!** This task uses Meta's latest DINOv3 model for self-supervised learning at unprecedented scale, 
  providing state-of-the-art image representations for geospatial analysis.
</Callout>

<VideoEmbed
  src="https://geobase-docs.s3.amazonaws.com/geobase-ai-assets/image-feature-extraction.mp4"
  title="Image Feature Extraction Demo"
/>

<div style={{ textAlign: 'center', marginTop: '1rem' }}>
  <a 
    href="https://docs.geobase.app/geoai-live/tasks/image-feature-extraction" 
    target="_blank" 
    rel="noopener noreferrer"
    style={{ 
      display: 'inline-flex', 
      alignItems: 'center', 
      gap: '0.5rem',
      padding: '0.5rem 1rem',
      backgroundColor: '#3b82f6',
      color: 'white',
      textDecoration: 'none',
      borderRadius: '0.375rem',
      fontWeight: '500',
      transition: 'background-color 0.2s'
    }}
    className="live-demo-button"
  >
    🚀 Try Live Demo
  </a>
</div>

<style jsx>{`
  .live-demo-button:hover {
    background-color: #2563eb !important;
  }
`}</style>

<div style={{ textAlign: 'center', marginTop: '0.5rem' }}>
  <a 
    href="https://huggingface.co/onnx-community/dinov3-vits16-pretrain-lvd1689m-ONNX" 
    target="_blank" 
    rel="noopener noreferrer"
    style={{ 
      fontSize: '0.875rem',
      color: '#6b7280',
      textDecoration: 'none'
    }}
  >
    🤗 View Model on Hugging Face
  </a>
</div>

## Quick Start

```typescript
import { geoai } from "geoai";

// Initialize pipeline with DINOv3 model
const pipeline = await geoai.pipeline(
  [{ task: "image-feature-extraction" }],
  providerParams
);

// Run feature extraction
const result = await pipeline.inference({
  inputs: { polygon: myPolygon },
});

console.log(`Extracted features for ${result.embeddings.length} patches`);
```

<Callout type="info" emoji="🎯">
  Uses Meta's DINOv3 model to extract high-dimensional feature vectors from satellite imagery patches. 
  DINOv3 provides state-of-the-art self-supervised learning for vision at unprecedented scale.
</Callout>

## Parameters

### Post-Processing

```typescript
postProcessingParams: {
  patchSize: 224; // Size of image patches in pixels
  overlap: 0.1;   // Overlap between patches (0.0-1.0)
}
```

### Map Source

```typescript
mapSourceParams: {
  zoomLevel: 18; // Image resolution (16-20)
}
```

See [Map Source Parameters](../concepts/InferenceParams#map-source-parameters) for more details.

## Use Cases

| Application           | Description                                    |
| --------------------- | ---------------------------------------------- |
| **Similarity Search** | Find similar areas across large datasets       |
| **Change Detection**  | Identify changes between time periods          |
| **Land Classification** | Categorize terrain types using embeddings     |
| **Anomaly Detection** | Find unusual patterns in satellite imagery     |
| **Feature Matching**  | Match corresponding features across images     |

## Output

Returns embeddings for each image patch:

```typescript
{
  embeddings: [
    {
      geometry: { /* patch polygon coordinates */ },
      properties: {
        embedding: [0.1, 0.2, 0.3, ...], // 1024-dimensional vector
        patchId: "patch_001"
      }
    }
  ]
}
```

## Coming Soon

<Callout type="info" emoji="🚧">
  Advanced features like similarity search and batch processing are coming soon!
</Callout>

<Callout type="warning" emoji="⚠️">
  Feature extraction requires more computational resources than object detection. Consider using Web Workers for better performance.
</Callout>
